package com.zygame.sdk.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import com.zygame.sdk.ZyGameSDK;

public class DBHelper extends SQLiteOpenHelper{
	private final static String DB_NAME = "ZYUser.db";
	private final static int DB_VERSION = 2;
	private static Context context;
	private static DBHelper dbHelper;
	
	public DBHelper(Context context) {
		super(context, DB_NAME, null, DB_VERSION);
		this.context = context;
		// TODO Auto-generated constructor stub
	}
	
	public static synchronized DBHelper newInstance() {
		if(dbHelper == null) {
			dbHelper = new DBHelper(ZyGameSDK.getInstance().getContext());
		}  
		return dbHelper;
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		// TODO Auto-generated method stub
		UserDao userDao = new UserDao();
		userDao.onCreate(db);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		// TODO Auto-generated method stub
		
	}

}
